<?php
//=======================================
//###################################
// Kayako Web Solutions
//
// Source Copyright 2001-2004 Kayako Infotech Ltd.
// Unauthorized reproduction is not allowed
// License Number: $%LICENSE%$
// $Author: mslaria $ ($Date: 2007/04/30 10:21:50 $)
// $RCSfile: index.php,v $ : $Revision: 1.5 $ 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//###################################
//=======================================

define("SWIFT_AREA", 110);

if (defined("SWIFTCUSTOMPATH"))
{
	chdir(SWIFTCUSTOMPATH);
} else {
	chdir('./../');
}
require_once ("./swift.php");

require_once ("./includes/functions_cron.php");
$cron = new Cron;

//define("PROCESSCRON", 1);
headerNoCache();

if (defined("USESHUTDOWNFUNC") && defined("PROCESSCRON"))
{
	if (!empty($_REQUEST["_t"]))
	{
		// Run a specific task
		$_SWIFT["crontitle"] = $_REQUEST["_t"];
		register_shutdown_function(array(&$cron, "runTask"));
	} else {
		header("Content-Type: image/gif");
		echo base64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
		register_shutdown_function(array(&$cron, "runPendingTasks"));
	}
} else {
	if (!empty($_REQUEST["_t"]))
	{
		// Run a specific task
		$_SWIFT["crontitle"] = $_REQUEST["_t"];
		$cron->runTask();
	} else {
		header("Content-Type: image/gif");
		echo base64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
		$cron->runPendingTasks();
	}
}
?>